﻿namespace SalesPortal.Web.Helpers
{
    using System;
    using System.Security.Cryptography;

    public class GeneratorHelper
    {
        public static CryptographicKeyHelper CryptographicKey = new CryptographicKeyHelper();

        public static CryptographicIVHelper CryptographicIV = new CryptographicIVHelper();

    }

    public class CryptographicKeyHelper
    {
        public static string ForDES()
        {
            // csp => Cryptographic Service Provider
            DESCryptoServiceProvider csp = (DESCryptoServiceProvider)DESCryptoServiceProvider.Create();
            csp.GenerateKey();
            return Convert.ToBase64String(csp.Key);
        }
    }

    public class CryptographicIVHelper
    {
        public static string ForDES()
        {
            DESCryptoServiceProvider csp = (DESCryptoServiceProvider)DESCryptoServiceProvider.Create();
            csp.GenerateIV();
            return Convert.ToBase64String(csp.IV);
        }
    }

} // namespace SalesPortal.Web.Helpers